Skip to content

Conversation

@tyler36
Copy link
Contributor

@tyler36 tyler36 commented Jun 9, 2025

Issue

On CakePHP 5.2.4, I get the following error:

Warning: Undefined array key 0 in /var/www/html/vendor/open-telemetry/opentelemetry-auto-cakephp/src/Hooks/Cake/Http/Server.php on line 29

Solution

This PR introduces a null check for $params[0] before attempting to cast it to a ServerRequestInterface. If $params[0] is null, the $request variable is set to null, preventing the error and allowing the instrumentation to continue gracefully (albeit without request-specific attributes).

@tyler36 tyler36 requested a review from a team as a code owner June 9, 2025 04:06
@welcome
Copy link

welcome bot commented Jun 9, 2025

Thanks for opening your first pull request! If you haven't yet signed our Contributor License Agreement (CLA), then please do so that we can accept your contribution. A link should appear shortly in this PR if you have not already signed one.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jun 9, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@tyler36 tyler36 force-pushed the Fix--Handle-null-request-in-CakePHP-Server--run-hook branch from 929cd78 to 89cc6be Compare June 9, 2025 04:26
@tyler36 tyler36 force-pushed the Fix--Handle-null-request-in-CakePHP-Server--run-hook branch from 89cc6be to c648903 Compare June 9, 2025 04:27
@tyler36 tyler36 closed this Jun 9, 2025
@tyler36 tyler36 deleted the Fix--Handle-null-request-in-CakePHP-Server--run-hook branch June 9, 2025 04:43
@tyler36 tyler36 restored the Fix--Handle-null-request-in-CakePHP-Server--run-hook branch June 9, 2025 04:43
@tyler36 tyler36 reopened this Jun 9, 2025
@tyler36
Copy link
Contributor Author

tyler36 commented Jun 9, 2025

Appolgies for the noise.
I renamed the branch and it closed the PR.

@codecov
Copy link

codecov bot commented Jun 9, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 82.14%. Comparing base (c15360b) to head (c648903).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...rumentation/CakePHP/src/Hooks/Cake/Http/Server.php 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #385      +/-   ##
============================================
+ Coverage     81.33%   82.14%   +0.81%     
- Complexity     1308     1801     +493     
============================================
  Files           116      137      +21     
  Lines          5630     7594    +1964     
============================================
+ Hits           4579     6238    +1659     
- Misses         1051     1356     +305     
Flag Coverage Δ
Aws 92.59% <ø> (ø)
Context/Swoole 0.00% <ø> (?)
Instrumentation/CakePHP 20.40% <0.00%> (ø)
Instrumentation/CodeIgniter 73.55% <ø> (ø)
Instrumentation/Doctrine 92.72% <ø> (ø)
Instrumentation/ExtAmqp 88.48% <ø> (ø)
Instrumentation/ExtRdKafka 86.11% <ø> (ø)
Instrumentation/Guzzle 69.13% <ø> (ø)
Instrumentation/HttpAsyncClient 78.04% <ø> (ø)
Instrumentation/IO 70.68% <ø> (ø)
Instrumentation/Laravel 63.91% <ø> (ø)
Instrumentation/MongoDB 74.28% <ø> (ø)
Instrumentation/MySqli 95.81% <ø> (ø)
Instrumentation/OpenAIPHP 87.21% <ø> (ø)
Instrumentation/PDO 94.21% <ø> (?)
Instrumentation/Psr14 76.47% <ø> (ø)
Instrumentation/Psr15 89.15% <ø> (?)
Instrumentation/Psr16 97.50% <ø> (ø)
Instrumentation/Psr18 77.46% <ø> (?)
Instrumentation/Psr3 67.01% <ø> (?)
Instrumentation/Psr6 97.61% <ø> (ø)
Instrumentation/ReactPHP 99.28% <ø> (ø)
Instrumentation/Slim 86.11% <ø> (?)
Instrumentation/Symfony 84.74% <ø> (ø)
Instrumentation/Yii 77.50% <ø> (ø)
Logs/Monolog 100.00% <ø> (ø)
Propagation/Instana 98.11% <ø> (ø)
Propagation/ServerTiming 100.00% <ø> (?)
Propagation/TraceResponse 100.00% <ø> (?)
ResourceDetectors/Azure 91.66% <ø> (ø)
ResourceDetectors/Container 93.02% <ø> (ø)
Sampler/RuleBased 33.51% <ø> (ø)
Shims/OpenTracing 92.45% <ø> (ø)
Symfony 87.81% <ø> (ø)
Utils/Test 87.53% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...rumentation/CakePHP/src/Hooks/Cake/Http/Server.php 0.00% <0.00%> (ø)

... and 21 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c15360b...c648903. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@brettmc brettmc merged commit 6732111 into open-telemetry:main Jun 10, 2025
137 of 140 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants